import MySQLdb
import random 
import datetime

conn = MySQLdb.connect(user='zc',passwd='zc',db='zc')
c = conn.cursor()

coletor_id = 2

for i in range(0,40):
    temperatura = random.randint(20, 30)
    data = datetime.datetime.now() + datetime.timedelta(hours=i)
    
    c.execute("INSERT INTO dashboard_historico (coletor_id, data, temperatura) VALUES " + \
              " (%s, %s, %s) ", (coletor_id, data, temperatura))

